package evi.com.evi.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import evi.com.evi.R;
import evi.com.evi.bean.BusinessVolBean;

public class BusinessVolAdapter<T> extends BaseAdapter {

    private Context mContext;
    private List<BusinessVolBean> mList;

    public BusinessVolAdapter(Context context, List<BusinessVolBean> mList) {
        this.mContext = context;
        this.mList = mList;
        if (this.mList == null) {
            this.mList = new ArrayList<BusinessVolBean>();
        }
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_lv_business_vol, null);

            viewHolder.item_time = (TextView) convertView.findViewById(R.id.item_time);
            viewHolder.item_money = (TextView) convertView.findViewById(R.id.item_money);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.item_time.setText(mList.get(position).getTime());
        viewHolder.item_money.setText("￥" + mList.get(position).getMoney());
        return convertView;
    }

    class ViewHolder {
        TextView item_time;
        TextView item_money;
    }

}
